<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/24/024
 * Time: 11:43
 */

namespace App\Validator;


class AdminUser extends BaseValidate
{
    protected $rules = [
        'id'=>'required|integer',
        'account'=>'required|alpha_num|between:4,20',
        'nickname'=>'required|string|between:2,30',
        'password'=>'required|alpha_num|min:6',
        're_password'=>'required|same:password',
        'tel'=>'required|phone',
        'email'=>'required|email',
        'name'=>'required|string|max:20',
        'sex'=>'required|in:-1,1,0',
        'avatar'=>'string|max:200',
        'status'=>'required|integer|in:-1,0,1'
    ];
    protected $messages = [
        'id.required'=>'id参数缺失',
        'id.integer'=>'id参数格式错误',
        'account.required'=>'账号参数缺失',
        'account.alpha_num'=>'账号只能是字母或者数字',
        'account.between'=>'账号长度为4到20位',
        'nickname.required'=>'昵称参数缺失',
        'nickname.string'=>'昵称参数格式不合法',
        'nickname.between'=>'昵称长度为2到30位',
        'password.required'=>'密码参数缺失',
        'password.alpha_num'=>'密码只能是字母或者数字',
        'password.min'=>'密码最短6位',
        're_password.required'=>'重复密码参数缺失',
        're_password.same'=>'两次密码不一致',
        'tel.required'=>'手机号码参数缺失',
        'tel.phone'=>'手机号码格式不合法',
        'email.required'=>'邮箱参数缺失',
        'email.email'=>'邮箱格式不合法',
        'name.required'=>'姓名参数缺失',
        'name.string'=>'姓名参数格式错误',
        'name.max'=>'姓名参数最长20位',
        'sex.required'=>'性别参数缺失',
        'sex.in'=>'性别参数不合法',
        'avatar.required'=>'头像参数缺失',
        'avatar.string'=>'头像参数格式错误',
        'avatar.max'=>'头像参数长度不合法',
        'status.required'=>'状态参数缺失',
        'status.integer'=>'状态参数格式错误',
        'status.in'=>'状态参数值错误',

    ];
    protected $scenes = [
        'add'=>['account','nickname','password','re_password','tel','sex','status','avatar','name'],
        'edit'=>['nickname','password','re_password','tel','sex','status','id','avatar','name'],
        'edit2'=>['nickname','tel','sex','status','id','avatar','name'],
        'login'=>['account','password'],
    ];

}